﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace RPGX.Graphics
{
    public class InputMouse
    {
        #region Properties

        public Rectangle Bounds
        {
            get { return _bounds; }
            set { _bounds = value; }
        }
        private Rectangle _bounds = new Rectangle();

        public MouseType Type
        {
            get { return _type; }
            set { _type = value; }
        }
        private MouseType _type = null;

        #endregion

        #region Public Methods

        public void Load(MouseType type)
        {
            this.Type = type;
            this.Bounds = new Rectangle(0, 0, this.Type.Width, this.Type.Height);
        }

        public void SetType(MouseType type)
        {
            this.Type = type;
            this.Bounds = new Rectangle(this.Bounds.X, this.Bounds.Y, this.Type.Width, this.Type.Height);
        }

        public void UnLoad()
        {
            this.Type = null;
        }

        public void Update(GameTime time)
        {
            MouseState state = Mouse.GetState();

            this.Bounds = new Rectangle(state.X, state.Y, this.Bounds.Width, this.Bounds.Height);
        }

        public void Render(SpriteBatch spriteBatch)
        {
            if (this.Type == null)
                return;

            spriteBatch.Draw(this.Type.Texture, this.Bounds, Color.White);
        }

        #endregion
    }
}
